extends Skill

func init():
	name = "黄道零号"
	dec = "你的回合开始时牌库手牌有任何牌/死亡/放逐/沉默时返回手牌，并夺取你的英雄一半的当前生命。"
	isIco = false

func _connect():
	card.scene.connect("onRoundStart",self,"r")
	card.connect("onExile",self,"r1")
	card.connect("onDeath",self,"r2")
	card.connect("onAddSkill",self,"r3")
	card.attBack.atk=card.att.atk
	card.attBack.maxHp=card.att.maxHp
	card.att.connect("onChange", self, "c")

func c(atk,hp):
	if card.attBack.atk == card.att.atk && card.attBack.maxHp == card.att.maxHp:return
	if card.att.maxHp<card.attBack.maxHp:
		card.att.maxHp = card.attBack.maxHp
	else: 
		card.attBack.maxHp = card.att.maxHp
	if card.attBack.atk == card.att.atk:return
	if card.att.atk<=card.attBack.atk:
		card.att.atk = card.attBack.atk
	else:
		card.attBack.atk = card.att.atk

func r():
	if sys.scene.roundhero == card.getHero():
		if sys.rndListItem(card.getHero().hand.items)!=null || sys.rndListItem(card.getHero().lib.items)!=null:
			card.exile()

func r1():
	card.delIdSkill("k_JRthec")

func r2(atkInfo):
	card.delIdSkill("k_JRthec")

func r3(skill):
	if skill==self:return
	if skill.id == "k_chenMo":
		card.delIdSkill("k_JRthec")
		return
	card.delSkill(skill)
	
func _del():
	card.exile()
	var a = card.getHero().newCard("c_BJThec")
	var aaa = card.getHero().hand.addCard(a, false)
	a.att.maxHp += card.getHero().att.hp/2
	card.getHero().att.hp = card.getHero().att.hp/2